#画出一个二次函数，同时画出梯形法求积分时的各个梯形

import numpy as np
import matplotlib.pyplot as plt
def equal(x):
    return x**2+4*x+5
x = np.linspace(-4,4,100)
y = equal(x)
plt.plot(x,y)
c = np.linspace(-4,4,40)
z = equal(c)

for i in range(40):
    plot_y = [z[i],0]
    plot_x = [c[i],c[i]]
    plt.plot(plot_x,plot_y,'b')
plt.ylim(0,38)
plt.show()
